﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using HelloMinasan.Domain;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using HelloMinasan.Business;
using HelloMinasan.Framework.Web.Validation;

namespace HelloMinasan.Web.ViewModels
{
    public class UserModel
    {

        public int Id { get; set; }

        [Required(ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "RequiredObject")]
        [RegularExpression(@"[A-Za-z0-9\.-]{3,50}", ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "InvalidObject")]
        public string Username { get; set; }

        [StringLength(50)]
        [Required]
        public string Password { get; set; }

        [Required]
        [StringLength(101)]
        public string DisplayName { get; set; }

        [Required]
        [StringLength(50)]
        public string FirstName { get; set; }

        [StringLength(50)]
        public string LastName { get; set; }

        [StringLength(100)]
        [Required]
        [RegularExpression(@"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$", ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "InvalidObject")]
        public string Email { get; set; }

        public DateTime CreatedTime { get; set; }

        public DateTime? ModifiedTime { get; set; }

        public DateTime? LastLoginTime { get; set; }

        public int PageView { get; set; }

        public UserType UserType { get; set; }

        public string FullName
        {
            get { return String.Concat(FirstName, " ", LastName); }
        }

        public UserStatus Status { get; set; }

        public string Locatiom { get; set; }

        public string AboutMe { get; set; }

        public bool HasAvatar { get; set; }
    }
}